var express = require('express');
var db = require('../../../tools/database')
var util = require('../../../tools/util')
var router = express.Router();

// 修改用户信息
// 错误处理标准化 √√
router.use(function(req, res, next) {

    util.jwtVerify(req, res, (decoded) =>{
        let userName = decoded.userName;
        let sql = `UPDATE Users SET UserDescription=?,UserQQ=?,UserWeChat=?,portraitFileName=? WHERE UserName=?`
        let userDescription = req.body.userDescription;
        let userQQ = req.body.userQQ;
        let userWeChat = req.body.userWeChat;
        let portraitFileName = req.body.portraitFileName;
        let options = [userDescription, userQQ, userWeChat, portraitFileName, userName];
        db.queryRespond(sql, options, res)
    })

});

module.exports = router;